package com.bdxk.android.imdemo;

import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.bdxk.android.imdemo.message.CustomizeMessageItemProvider;
import com.bdxk.android.imdemo.message.MyMessage;

import io.rong.imkit.RongIM;
import io.rong.imlib.RongIMClient;

public class App extends Application {
    //测试token
    public static String imToken = "/BqePIlAaFybmYiy3x4oL8UGPSqpbIgKcDIk5TN0yfm0nnUZ2GRER3lQOIO/473NtfdmWA1TAs4/EE9ZDeTKcQ==";

    @Override
    public void onCreate() {
        super.onCreate();
        RongIM.init(this);
        RongIM.registerMessageType(MyMessage.class);
        RongIM.registerMessageTemplate(new CustomizeMessageItemProvider());
    }

    public static String getCurProcessName(Context context) {
        int pid = android.os.Process.myPid();
        ActivityManager mActivityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningAppProcessInfo appProcess : mActivityManager
                .getRunningAppProcesses()) {
            if (appProcess.pid == pid) {

                return appProcess.processName;
            }
        }
        return null;
    }
}